from django.http import HttpResponse
from gaev.views import object_index
from data import models
from random import randint
import django

def list(request, model_name=None):
    mdl=models.get('Division')
    div=mdl(short='ab', name='ab'+str(randint(1,10)))
    div.put()
    names=[]
    for dObj in mdl.all():
        names.append(dObj.name)
    res=','.join(names)
    return HttpResponse(res)


def index(request, model_name):
    model=models.get(model_name)
    query=model.objects.all()
    return object_index(request, query)
